<template>
  <div>
    <title-card title="excel数据导入示例" />
    <ImportExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD">
      <n-button> 导入Excel </n-button>
    </ImportExcel>
    <BasicTable
      v-for="(table, index) in tableList"
      :key="index"
      :title="table.meta.sheetName"
      :header="table.header"
      :dataSource="table.results"
    />
  </div>
</template>

<script lang="ts" name="PageWrapper" setup>
import TitleCard from "@/components/TitleCard/index.vue";
import ImportExcel from "./ImportExcel.vue"
import BasicTable from "./BasicTable.vue"
import { ref } from "vue"

const tableList = ref([]);
const loadDataSuccess = (excelDataList:any) => {
  tableList.value = excelDataList;
}
</script>